package com.zhj.datasource;

import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class MySqlConfig {
	protected static SqlMapClient sqlMapClient=null;
	static{
		try{
			String resource="com/zhj/sqlMapConfig.xml";
			Reader reader=Resources.getResourceAsReader(resource);
			sqlMapClient=SqlMapClientBuilder.buildSqlMapClient(reader);
		}catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException("读取datasource文件错误"+e);
		}
	}
	public static SqlMapClient getSqlMapInstance(){
		return sqlMapClient;
	}
}
